package com.cn.serverline.lineicp.productionLine.controller;

import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import javax.annotation.Resource;

import com.cn.serverline.lineicp.productionLine.param.WorkSectionAddParam;
import com.cn.serverline.lineicp.productionLine.param.WorkSectionEditParam;
import com.cn.serverline.lineicp.productionLine.param.WorkSectionIdParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import com.cn.serverline.lineicp.productionLine.entity.WorkSection;
import com.cn.serverline.lineicp.productionLine.service.IWorkSectionService;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;


/**
 * 滚动计划-工段表 接口
 *
 * @author Gmr
 * @since 2024-07-28
 */
@RestController
@Api(tags = "滚动计划-工段")
@ApiResource(name = "滚动计划-工段表的接口")
public class WorkSectionController {

    @Resource(name = "WorkSectionServiceImpl")
    private IWorkSectionService iWorkSectionService;

    /**
     * 添加滚动计划-工段表
     */
    @ApiOperation(value = "添加滚动计划-工段")
    @PostResource(name = "添加滚动计划-工段表", path = "/productionLine/workSection/add")
    public ResponseData<?> add(@RequestBody @Validated WorkSectionAddParam workSection){
        iWorkSectionService.add(workSection);
        return new SuccessResponseData<>();
    }

    /**
     * 删除滚动计划-工段表
     */
    @ApiOperation(value = "删除滚动计划-工段")
    @PostResource(name = "删除滚动计划-工段表", path = "/productionLine/workSection/delete")
    public ResponseData<?> delete(@RequestBody @Validated WorkSectionIdParam workSection){
        iWorkSectionService.del(workSection);
        return new SuccessResponseData<>();
    }

    /**
     * 编辑滚动计划-工段表
     */
    @ApiOperation(value = "编辑滚动计划-工段")
    @PostResource(name = "编辑滚动计划-工段表", path = "/productionLine/workSection/edit")
    public ResponseData<?> edit(@RequestBody @Validated WorkSectionEditParam workSection) {
        iWorkSectionService.edit(workSection);
        return new SuccessResponseData<>();
    }

    /**
     * 分页查询-滚动计划-工段表列表
     */
    @ApiOperation(value = "分页查询-滚动计划-工段列表")
    @GetResource(name = "分页查询-滚动计划-工段表列表", path = "/productionLine/workSection/page")
    public ResponseData<PageResult<WorkSection>> page(WorkSection workSection) {
        return new SuccessResponseData<>(iWorkSectionService.findPage(workSection));
    }

    /**
     * 查询滚动计划-工段表详情
     */
    @ApiOperation(value = "查询滚动计划-工段详情")
    @GetResource(name = "查询滚动计划-工段表详情", path = "/productionLine/workSection/detail")
    public ResponseData<WorkSection> detail(@Validated WorkSectionIdParam workSection) {
        return new SuccessResponseData<>(iWorkSectionService.detail(workSection));
    }

}
